import { getOrganizationTypeEnumSchema } from '@/enums/organizationTypeEnum';
import { AdColumn } from '@/components/AdVxeTable';
import { useI18n } from '@/hooks/web/useI18n';

const organizationTypeEnumSchema = getOrganizationTypeEnumSchema();

const { t } = useI18n();

export const columns: AdColumn[] = [
  {
    title: t('entity.idTitle'),
    field: 'Id',
    width: 0,
    visible: false,
    formVisible: false,
    formEditable: false,
    filterable: true,
    dataType: 'integer',
    //align: 'left',
  },
  {
    title: t('routes.system.identity.organization.nameTitle'),
    field: 'Name',
    width: 300,
    treeNode: true,
    filterable: true,
    dataType: 'string',
  },
  {
    title: t('routes.system.identity.organization.typeTitle'),
    field: 'Type',
    width: 80,
    filterable: true,
    dataType: 'enum',
    enumData: organizationTypeEnumSchema,
  },
  {
    title: t('routes.system.identity.organization.descriptionTitle'),
    field: 'Description',
    width: 300,
    filterable: true,
    dataType: 'string',
  },
  {
    title: t('routes.system.identity.organization.nameFrgnTitle'),
    field: 'NameFrgn',
    width: 0,
    visible: false,
    filterable: true,
    filterIndex: 'Detail.NameFrgn',
    dataType: 'string',
  },
  {
    title: t('routes.system.identity.organization.addressTitle'),
    field: 'Address',
    width: 0,
    visible: false,
    filterable: true,
    filterIndex: 'Detail.Address',
    dataType: 'string',
  },
  {
    title: t('routes.system.identity.organization.addressFrgnTitle'),
    field: 'AddressFrgn',
    width: 0,
    visible: false,
    filterable: true,
    filterIndex: 'Detail.AddressFrgn',
    dataType: 'string',
  },
  {
    title: t('routes.system.identity.organization.printHeaderTitle'),
    field: 'PrintHeader',
    width: 0,
    visible: false,
    filterable: true,
    filterIndex: 'Detail.PrintHeader',
    dataType: 'string',
  },
  {
    title: t('routes.system.identity.organization.printHeaderFrgnTitle'),
    field: 'PrintHeaderFrgn',
    width: 0,
    visible: false,
    filterable: true,
    filterIndex: 'Detail.PrintHeaderFrgn',
    dataType: 'string',
  },
  {
    title: t('routes.system.identity.organization.reptNameTitle'),
    field: 'ReptName',
    width: 0,
    visible: false,
    filterable: true,
    filterIndex: 'Detail.ReptName',
    dataType: 'string',
  },
  {
    title: t('routes.system.identity.organization.reptNameFrgnTitle'),
    field: 'ReptNameFrgn',
    width: 0,
    visible: false,
    filterable: true,
    filterIndex: 'Detail.ReptNameFrgn',
    dataType: 'string',
  },
  {
    title: t('routes.system.identity.organization.remarkTitle'),
    field: 'Remark',
    width: 0,
    visible: false,
    filterable: true,
    filterIndex: 'Detail.Remark',
    dataType: 'text',
  },
  {
    title: t('routes.system.identity.organization.orderNoTitle'),
    field: 'OrderNo',
    width: 80,
    filterable: false,
    dataType: 'number',
  },
  {
    title: t('routes.system.identity.organization.treePathStringTitle'),
    field: 'TreePathString',
    width: 0,
    visible: false,
    filterable: false,
    dataType: 'text',
  },
  {
    title: t('routes.system.identity.organization.parentIdTitle'),
    field: 'ParentId',
    width: 0,
    visible: false,
    filterable: false,
    dataType: 'integer',
  },
  {
    title: t('routes.system.identity.organization.enableLoginTitle'),
    field: 'EnableLogin',
    width: 80,
    filterable: true,
    dataType: 'boolean',
  },
  {
    title: t('routes.system.identity.organization.isDefaultTitle'),
    field: 'IsDefault',
    width: 80,
    filterable: true,
    dataType: 'boolean',
  },
  {
    title: t('routes.system.identity.organization.isSystemTitle'),
    field: 'IsSystem',
    width: 80,
    filterable: true,
    dataType: 'boolean',
  },
  {
    title: t('entity.lockable.isLockedTitle'),
    field: 'IsLocked',
    width: 75,
    filterable: true,
    dataType: 'boolean',
  },
  {
    title: t('routes.system.identity.organization.levelTitle'),
    field: 'Level',
    width: 50,
    filterable: false,
    dataType: 'integer',
  },
  {
    title: t('entity.creationAudited.creatorIdTitle'),
    field: 'CreatorId',
    width: 0,
    visible: false,
    filterable: true,
    dataType: 'integer',
  },
  {
    title: t('entity.creationAudited.creatorNameTitle'),
    field: 'CreatorName',
    width: 0,
    visible: false,
    filterIndex: 'CreatorId',
    filterJoin: {
      entityType: 'MicroCloud.Pack.Identity.Entities.User,MicroCloud.Pack.Identity',
      filterField: 'UserName',
      selectField: 'Id',
    },
    dataType: 'string',
  },
  {
    title: t('entity.creationAudited.creatorNicknameTitle'),
    field: 'CreatorNickname',
    width: 0,
    visible: false,
    filterIndex: 'CreatorId',
    filterJoin: {
      entityType: 'MicroCloud.Pack.Identity.Entities.User,MicroCloud.Pack.Identity',
      filterField: 'NickName',
      selectField: 'Id',
    },
    dataType: 'string',
  },
  {
    title: t('entity.creationAudited.createdTimeTitle'),
    field: 'CreatedTime',
    width: 150,
    formVisible: true,
    formEditable: false,
    filterable: true,
    dataType: 'datetime',
  },
  {
    title: t('entity.updateAudited.updaterIdTitle'),
    field: 'UpdaterId',
    width: 0,
    visible: false,
    filterable: true,
    dataType: 'integer',
  },
  {
    title: t('entity.updateAudited.updaterNameTitle'),
    field: 'UpdaterName',
    width: 0,
    visible: false,
    filterable: true,
    filterIndex: 'UpdaterId',
    filterJoin: {
      entityType: 'MicroCloud.Pack.Identity.Entities.User,MicroCloud.Pack.Identity',
      filterField: 'UserName',
      selectField: 'Id',
    },
    dataType: 'string',
  },
  {
    title: t('entity.updateAudited.updaterNicknameTitle'),
    field: 'UpdaterNickname',
    width: 0,
    visible: false,
    filterable: true,
    filterIndex: 'UpdaterId',
    filterJoin: {
      entityType: 'MicroCloud.Pack.Identity.Entities.User,MicroCloud.Pack.Identity',
      filterField: 'NickName',
      selectField: 'Id',
    },
    dataType: 'string',
  },
  {
    title: t('entity.updateAudited.updatedTimeTitle'),
    field: 'UpdatedTime',
    width: 150,
    formVisible: true,
    formEditable: false,
    filterable: true,
    dataType: 'datetime',
  },
];
